<?php
namespace app\admin\controller;
use think\facade\Db;
use think\facade\View;
class Set
{
    public function adv()
    {
        $list=Db::name("banner")->order('sort')->select();
        View::assign("list",$list);
        return view();
    }

    public function info()
    {
        return view();
    }

    public function pass()
    {
        return view();
    }
    public function brand()
    {

        $where=[];

        $if_show=request()->post('if_show');
        if($if_show!=''  ){
            $where[]=['if_show','=',$if_show];
        }

        $recomended=request()->post('recommended');
        if($recomended!='' && count($recomended)==1){
            $where[]=['recommended','in',$recomended];
        }


        if(request()->post('headimg')!='' && count(request()->post('headimg'))==1){
            if(request()->post('headimg')[0]==1){
                $where[]=['brand_logo','<>',''];
            }else{
                $where[]=['brand_logo','=',''];
            }
        }

        $keywords=request()->post('keywords');
        if($keywords!=''){
            $where[]=['brand_name','like','%'.$keywords.'%'];
        }
        View::assign(input(''));

        $all=Db::name('brand')
            ->field(true)
            ->order('sort_order')
            ->where($where)
            ->select();
        View::assign('all',$all);
        return view();

    }
}